/**
* @Author: Devin
* @Date: 2018-09-13 14:04:23
* @Author Email by: 3481653@gmail.com
* @Last Modified time: 2018-09-13 14:04:23
*/

import request from '@/utils/request'

/**
 * 我的商户初始化
 * @param {Number} user_num 代理商编号
 */
export function myCommerInit(user_num) {
  return request({
    url: '/merchant/my_merchant_list',
    method: 'GET',
    params: { user_num }
  })
}

/**
 * 我的商户查询
 * @param {Number} id 代理商id
 * @param {Object} date 查询参数
 */
export function myCommerSearch(user_num, date) {
  return request({
    url: '/merchant/my_merchant_list',
    method: 'GET',
    params: { user_num, merchant_num: date.merchant_num, full_name: date.full_name, start_time: date.time[0], stop_time: date.time[1] }
  })
}

/**
 * 我的商户分页
 * @param {Number} user_num 代理商编号
 * @param {Number} page 页码
 * @param {Object} date 查询参数
 */
export function myCommerPage(user_num, page, date) {
  return request({
    url: '/merchant/my_merchant_list',
    method: 'GET',
    params: { page, user_num, merchant_num: date.merchant_num, full_name: date.full_name, start_time: date.start_time, stop_time: date.stop_time }
  })
}

/**
 * 我的商户修改资料获取信息
 * @param {Number} merchant_id 代理商id
 */
export function editShopInit(merchant_id) {
  return request({
    url: '/editMyCommer',
    method: 'GET',
    params: { merchant_id }
  })
}

/**
 * 我的商户通道费率配置初始化
 * @param {Number} merchant_num 商户号
 */
export function myCommerChannelInit(merchant_num) {
  return request({
    url: '/merchant/get_merchant_enable_channels',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 * 我的商户通道费率配置POS机初始化
 * @param {Number} merchant_num 商户号
 */
export function myCommerChannelPosInit(merchant_num) {
  return request({
    url: '/merchant/get_enable_channel_pos',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 * 通道费率配置提交
 */
export function myCommerChannelUpdate(date, merchant_num) {
  const data = {
    merchant_num,
    channels: {
      '10-1-0': {
        open_status: date.wx_open,
        rate: date.wx
      },
      '10-2-0': {
        open_status: date.ali_open,
        rate: date.ali
      },
      '10-1-2': {
        open_status: date.ws_wx_open,
        rate: date.ws_wx
      },
      '10-2-2': {
        open_status: date.ws_ali_open,
        rate: date.ws_ali
      },
      '10-1-3': {
        open_status: date.fu_wx_open,
        rate: date.fu_wx
      },
      '10-2-3': {
        open_status: date.fu_ali_open,
        rate: date.fu_ali
      },
      '10-1-4': { // d0
        open_status: date.le_wx_open,
        rate: { wx: date.le_wx_t0, ali: date.le_ali_t0 }
      },
      '10-2-4': { // d1
        open_status: date.le_ali_open,
        rate: { wx: date.le_wx_t1, ali: date.le_ali_t1 }
      },
      '10-1-5': {
        open_status: date.xdl_wx_open,
        rate: date.xdl_scan
      },
      '10-2-5': {
        open_status: date.xdl_ali_open,
        rate: date.xdl_scan
      },
      '10-5-5': {
        open_status: date.xdl_norm_open,
        rate: { unionpay_sta: date.xdl_norm, unionpay_dis: date.xdl_off }
      }
    }
  }
  return request({
    url: '/merchant/update_channel_open_status',
    method: 'POST',
    data
  })
}

/**
 * 通道配置POS机
 */
export function myCommerPosChannelUpdate(merchant_num, date, status) {
  const data = {
    merchant_num,
    channels: {
      '20-0-5': {
        open_status: status.xdl_active,
        pos_rates: {
          credit: date.xdl_credit,
          debit: date.xdl_debit,
          pos_debit_max: date.pos_debit_max
        }
      },
      '20-0-4': {
        open_status: status.le_d1_active ? 200 : status.le_d0_active ? 100 : false,
        pos_rates: {
          debit: {
            d1: {
              rate: date.debit_d1,
              ceiling: date.debit_money
            },
            d0: {
              rate: date.debit_d0
            }
          },
          credit: {
            d1: {
              rate: date.credit_d1
            },
            d0: {
              rate: date.credit_d0
            }
          },
          ovsea: {
            d1: {
              rate: date.ovsea_d1
            },
            d0: {
              rate: date.ovsea_d0
            }
          }
        }
      }
    }
  }
  return request({
    url: '/merchant/update_channel_status_pos',
    method: 'POST',
    data
  })
}

/**
 * 下属商户初始化
 * @param {Number} id 代理商id
 */
export function subCommerInit(user_num) {
  return request({
    url: '/merchant/sub_merchant_list',
    method: 'GET',
    params: { user_num }
  })
}

/**
 * 下属商户代理商名称获取
 */
export function subCommerGetAgent(user_num) {
  return request({
    url: '/agent/sub_agent_list',
    method: 'GET',
    params: { user_num }
  })
}

/**
 * 所有代理商名称获取
 */
export function CommerGetAgent(user_num) {
  return request({
    url: '/agent/agent_list',
    method: 'GET',
    params: { user_num }
  })
}

/**
 * 下属商户详情代理商区域获取
 * @param {NUmber} merchant_id 商户id
 */
export function handleBusinssesAddress(merchant_id) {
  return request({
    url: '/subQuery',
    method: 'GET',
    params: { merchant_id }
  })
}

/**
 * 下属商户搜索
 * @param {Number} id 代理商id
 * @param {Number} date 代理商id
 */
export function subCommerSearch(user_num, date) {
  return request({
    url: '/merchant/sub_merchant_list',
    method: 'GET',
    params: { user_num, merchant_num: date.serial_num, full_name: date.store, short_name: date.print_name, agent_num: date.agent_id }
  })
}

/**
 * 下属商户分页
 * @param {Number} id 代理商id
 * @param {Number} page 页码
 * @param {Object} date 查询参数
 */
export function subCommerPage(user_num, page, date) {
  return request({
    url: '/merchant/sub_merchant_list',
    method: 'GET',
    params: { user_num, page, merchant_num: date.serial_num, full_name: date.store, short_name: date.print_name, agent_num: date.agent_id }
  })
}

/**
 * 根据登陆者获取代理商信息
 */
export function agent_info() {
  return request({
    url: '/agent/agent_info',
    method: 'GET'
  })
}

/**
 * 验证邮箱唯一性
 * @param {String} name 邮箱
 */
export function verifyEmailOnly(name) {
  const data = {
    name
  }
  return request({
    url: '/merchant/verify_only',
    method: 'POST',
    data
  })
}

/**
 * 获取业务员列表
 * @param {Number} 代理商编号
 */
export function salesman(user_num) {
  return request({
    url: '/agent/sale_list',
    method: 'GET',
    params: { user_num }
  })
}

/**
 * 开户行远程搜索
 */
export function GetSearchBankList(name) {
  return request({
    url: '/merchant/get_bank_name',
    method: 'GET',
    params: { name }
  })
}

/**
 * 证件类型证件类型切换
 * @param {Number} type 商户类型 100=公司，200=个体工商户，300=自然人
 */
export function ToggleType(type) {
  return request({
    url: '/merchant/id_type',
    method: 'GET',
    params: { type }
  })
}

/**
 * 商户详情初试化
 * @param {Number} merchant_num 商户编号
 */
export function baseDetailsInit(merchant_num) {
  return request({
    url: '/merchant/get_merchant_info',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 * 商户基础资料入驻
 * @param {Object} date 入驻资料
 * @param {Object} agent 入驻资料
 */
export function merchant_add(type, date, agent) {
  const data = {
    type,
    agent_num: agent.agent_num,
    full_name: date.full_name,
    short_name: date.short_name,
    service_phone: date.service_phone,
    real_address: date.real_address,
    bus_licence_type: date.bus_licence_type,
    alipay_name: date.alipay_name,
    alipay_account: date.alipay_account,
    bus_licence_no: date.bus_licence_no,
    bus_licence_expire: date.bus_licence_expire,
    bus_licence: date.bus_licence,
    store_face: date.store_face,
    store_counter: date.store_counter,
    store_canyin_plat: date.store_canyin_plat,
    store_space: date.store_space,
    bus_licence_oth: date.fileList,
    bus_lease_agreement: date.bus_lease_agreement,
    bus_licence_reg_date: date.bus_licence_reg_date,
    mod: 1,
    sale_num: agent.sale_num,
    name: agent.username,
    password: agent.password
  }
  return request({
    url: '/merchant/create_merchant',
    method: 'POST',
    data
  })
}

/**
 * 基础资料审核初始化
 * @param {Number} user_num 代理商编号
 */
export function auditBaseInit(user_num) {
  return request({
    url: '/merchant/get_wait_check_list',
    method: 'GET',
    params: { user_num }
  })
}

/**
 * 基础资料审核分页
 * @param {Number} user_num 代理商编号
 * @param {Number} page 页码
 * @param {Object} date 查询参数
 */
export function auditBasePage(user_num, page, date) {
  return request({
    url: '/merchant/get_wait_check_list',
    method: 'GET',
    params: { user_num, page, agent_num: date.agent_name, merchant_num: date.number, full_name: date.name }
  })
}

/**
 * 基础资料审核查询
 * @param {Number} user_num 代理商编号
 * @param {Object} date 查询参数
 */
export function auditBaseSearch(user_num, date) {
  return request({
    url: '/merchant/get_wait_check_list',
    method: 'GET',
    params: { user_num, agent_num: date.agent_name, merchant_num: date.number, full_name: date.name }
  })
}

/**
 * 通道审核初始化
 */
export function auditChannelInit() {
  return request({
    url: '/merchant/channel_verify_list',
    method: 'GET'
  })
}

/**
 * 通道审核分页
 * @param {Number} page 页码
 * @param {Object} date 查询参数
 */
export function auditChannelPage(page, date) {
  return request({
    url: '/merchant/channel_verify_list',
    method: 'GET',
    params: { page, agent_num: date.agent_name, merchant_num: date.number, full_name: date.name }
  })
}

/**
 * 通道审核查询
 * @param {Object} date 查询参数
 */
export function auditChannelSearch(date) {
  return request({
    url: '/merchant/channel_verify_list',
    method: 'GET',
    params: { agent_num: date.agent_name, merchant_num: date.number, full_name: date.name }
  })
}

/**
 * 地区获取
 */
export function areaAddress() {
  return request({
    url: '/merchant/area_list',
    method: 'GET'
  })
}

/**
 * 商户基础资料更新
 * @param {Number} type 类型
 * @param {Object} date 入驻资料
 */
export function merchantBaseUpdate(user_num, merchant_num, type, date, password) {
  const data = {
    merchant_num,
    user_num,
    info: {
      password,
      type,
      full_name: date.full_name,
      short_name: date.short_name,
      service_phone: date.service_phone,
      real_address: date.real_address,
      bus_licence_type: date.bus_licence_type,
      alipay_name: date.alipay_name,
      alipay_account: date.alipay_account,
      store_canyin_plat: date.store_canyin_plat,
      bus_licence_no: date.bus_licence_no,
      bus_licence_expire: date.bus_licence_expire,
      bus_licence: date.bus_licence,
      store_face: date.store_face,
      store_counter: date.store_counter,
      store_space: date.store_space,
      bus_licence_oth: date.fileList,
      bus_lease_agreement: date.bus_lease_agreement,
      bus_licence_reg_date: date.bus_licence_reg_date,
      mod: 1
    },
    bank: {},
    leader: {},
    contact: {},
    wx: {}
  }
  return request({
    url: '/merchant/update_merchant',
    method: 'POST',
    data
  })
}

/**
 * 商户入驻银行账户资料更新
 * @param {Number} merchant_num 商户编号
 * @param {Number} user_num 代理商编号
 */
export function merchantBankUpdate(merchant_num, user_num, date) {
  const data = {
    merchant_num,
    user_num,
    bank: {
      leader_type: date.leader_type,
      bank_idcard_1: date.leader_id_1,
      bank_id_card_expire: date.bank_id_card_expire,
      bank_idcard_2: date.leader_id_2,
      leader_id_3: date.leader_id_3,
      bank_account_type: date.bank_account_type,
      bank_account_name: date.bank_account_name,
      bank_account_no: date.bank_account_no,
      bank_code: date.bank_code,
      bank_branch_name: date.bank_branch_name,
      bank_branch_code: date.bank_branch_code,
      bank_address: date.bank_address,
      bank_pre_mobile: date.bank_pre_mobile,
      bank_id_card_addr: date.bank_id_card_addr,
      bank_id_card_no: date.bank_id_card_no,
      bank_id_card_type: date.bank_id_card_type,
      bank_permit: date.bank_permit,
      bank_card_inhand: date.bank_head,
      bank_card: date.bank_card,
      mod: 2
    },
    info: {},
    leader: {},
    contact: {},
    wx: {}
  }
  return request({
    url: '/merchant/update_merchant',
    method: 'POST',
    data
  })
}

/**
 * 商户入驻负责人信息资料更新
 * @param {Number} merchant_num 商户编号
 * @param {Number} user_num 代理商编号
 * @param {Object} date 数据
 */
export function merchantPrincipalUpdate(merchant_num, user_num, date) {
  const data = {
    merchant_num,
    user_num,
    info: {},
    bank: {},
    leader: {
      leader_type: date.leader_type,
      leader_name: date.leader_name,
      leader_id_expire: date.leader_time,
      leader_phone: date.leader_phone,
      leader_id_no: date.leader_id_no,
      leader_id_type: date.leader_id_type,
      leader_id_1: date.leader_id_1,
      leader_id_2: date.leader_id_2,
      leader_id_3: date.leader_id_3,
      mod: 3
    },
    contact: {},
    wx: {}
  }
  return request({
    url: '/merchant/update_merchant',
    method: 'POST',
    data
  })
}

/**
 * 商户入驻联系人信息资料更新
 * @param {Number} merchant_num 商户编号
 * @param {Number} user_num 代理商编号
 * @param {Object} date 提交参数
 */
export function merchatnContactUpdate(merchant_num, user_num, date) {
  const data = {
    merchant_num,
    user_num,
    info: {},
    wx: {},
    bank: {},
    leader: {},
    contact: {
      contact_name: date.contact_name,
      contact_phone: date.contact_phone,
      contact_id_no: date.contact_id_no,
      contact_duties: date.contact_duties,
      contact_email: date.contact_email,
      contact_weixin: date.contact_weixin,
      cantact_alipay: date.cantact_alipay,
      contact_qq: date.contact_qq
    }
  }
  return request({
    url: '/merchant/update_merchant',
    method: 'POST',
    data
  })
}

/**
 * 商户入驻微信信息资料更新
 * @param {Number} merchant_num 商户编号
 * @param {Number} user_num 代理商编号
 * @param {Object} date 提交参数
 */
export function merchantWechatUpdate(merchant_num, user_num, date) {
  const data = {
    merchant_num,
    user_num,
    info: {},
    bank: {},
    leader: {},
    contact: {},
    wx: {
      weixin_appid: date.weixin_appid,
      weixin_secret: date.weixin_secret
    }
  }
  return request({
    url: '/merchant/update_merchant',
    method: 'POST',
    data
  })
}

/**
 * 获取通道审核状态
 */
export function merchanenlChannelGetStatus(merchant_num) {
  return request({
    url: '/merchant/channel_list',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 * 基础资料审核
 * @param {Number} merchant_num 商户编号
 * @param {Number} status 审核状态
 * @param {Number} type 资料标识
 * @param {String} remark 备注
 */
export function merchantCheckBaseStatus(merchant_num, status, type, remark) {
  const data = {
    merchant_num,
    status,
    type,
    remark
  }
  return request({
    url: '/merchant/check_merchant_status',
    method: 'POST',
    data
  })
}

/**
 * 商户支付宝通道修改
 * @param {Number} merchant_num 商户编号
 * @param {Object} date 参数
 */
export function merchantChannelAliUpdate(merchant_num, date) {
  const data = {
    merchant_num,
    ali_count: date.ali_count,
    ali_pid: date.ali_pid,
    rate: date.rate,
    balance_type: date.balance_type,
    expire_time: date.expire_time,
    expire_rate: date.expire_rate,
    channel_type: date.channel_type
  }
  return request({
    url: '/merchant/channel/ali/submit',
    method: 'POST',
    data
  })
}

/**
 * 商户微信通道修改
 * @param {Number} merchant_num 商户编号
 * @param {Object} date 参数
 */
export function merchantChannelWxUpdate(merchant_num, date) {
  const data = {
    merchant_num,
    app_id: date.app_id,
    wx_commer_id: date.wx_commer_id,
    rate: date.rate,
    balance_type: date.balance_type,
    expire_time: date.expire_time,
    expire_rate: date.expire_rate,
    channel_type: date.channel_type
  }
  return request({
    url: '/merchant/channel/wx/submit',
    method: 'POST',
    data
  })
}

/**
 * 商户支付宝通道查看
 * @param {Number} merchant_num 商户编号
 */
export function merchantChannelAliQuery(merchant_num) {
  return request({
    url: '/merchant/channel/ali/query',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 * 商户微信通道查看
 * @param {Number} merchant_num 商户编号
 */
export function merchantChannelWxQuery(merchant_num) {
  return request({
    url: '/merchant/channel/wx/query',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 * 富民普通通道查看
 * @param {Number} merchant_num 商户编号
 */
export function merchantChannelFuQuery(merchant_num) {
  return request({
    url: '/merchant/channel/fuming/query',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 * 富民活动通道查看
 * @param {Number} merchant_num 商户编号
 */
export function merchantChannelFuActivityQuery(merchant_num) {
  return request({
    url: '/merchant/get_fumin_channel_verify_special',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 * 富民普通通道提交
 * @param {Number} merchant_num 商户编号
 * @param {Object} date 商户编号
 */
export function merchantChannelFuUpdate(merchant_num, date) {
  const data = {
    merchant_num,
    area: date.area,
    address: date.address,
    wx_rate: date.wx_rate,
    wx_category: date.wx_category,
    need_channel: date.need_channel,
    ali_rate: date.ali_rate,
    ali_category: date.ali_category
  }
  return request({
    url: '/merchant/channel/fuming/apply',
    method: 'POST',
    data
  })
}

/**
 * 富民活动通道提交
 * @param {Number} merchant_num 商户编号
 * @param {Object} date 商户编号
 */
export function merchantChannelFuActivityUpdate(merchant_num, date) {
  const data = {
    merchant_num,
    area: date.area,
    address: date.address,
    login_phone: date.login_phone,
    login_email: date.login_email,
    wx_rate: date.wx_rate,
    wx_category: date.wx_category,
    need_channel: date.need_channel,
    ali_rate: date.ali_rate,
    ali_category: date.ali_category,
    is_blue: date.is_blue,
    is_green: date.is_green,
    ch_fumin_face: date.ch_fumin_face,
    ch_fumin_activity: date.ch_fumin_activity,
    ch_fumin_canyin_plat: date.ch_fumin_canyin_plat,
    ch_fumin_blue_counter: date.ch_fumin_blue_counter,
    ch_fumin_green_counter: date.ch_fumin_green_counter,
    ch_fumin_canyin_appoint: date.ch_fumin_canyin_appoint
  }
  return request({
    url: '/merchant/channel/fuming/apply_special_merchant',
    method: 'POST',
    data
  })
}

/**
 * 富民通道支付宝经营类别获取
 */
export function merchantChannelFuAliCategory() {
  return request({
    url: '/merchant/channel/fuming/ali_category',
    method: 'GET'
  })
}

/**
 * 富民通道微信经营类别获取
 */
export function merchantChannelFuWxCategory() {
  return request({
    url: '/merchant/channel/fuming/wx_category',
    method: 'GET'
  })
}

/**
 * 乐刷通道查看
 * @param {Number} merchant_num 商户编号
 */
export function merchantChannelLeQuery(merchant_num) {
  return request({
    url: '/merchant/channel/lepos/query',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 * 乐刷通道经营类别获取
 */
export function merchantChannelLeCategory() {
  return request({
    url: '/merchant/channel/lepos/category',
    method: 'GET'
  })
}

/**
 * 乐刷通道餐饮行业查询
 */
export function merchantChannelLeHealthPermit(mcc) {
  return request({
    url: 'merchant/channel/lepos/is_food',
    method: 'GET',
    params: { mcc }
  })
}

/**
 * 乐刷地址获取
 */
export function maerchantChannelLeAddress() {
  return request({
    url: 'merchant/lepos_region',
    method: 'GET'
  })
}

/**
 * 乐刷通道提交
 * @param {Number} merchant_num 商户编号
 * @param {Object} date 商户编号
 */
export function merchantChannelLeUpdate(merchant_num, date) {
  const data = {
    merchant_num,
    area: date.area,
    address: date.address,
    mcc: date.mcc,
    mch_short_name: date.mch_short_name,
    balance_type: date.balance_type,
    card: date.card,
    photo: {
      channel_lepos_place_evid: date.channel_lepos_agreement,
      channel_lepos_netprot: date.channel_lepos_network_access_protocol,
      store_licence_hyg: date.store_licence_hyg,
      ch_lpos_certi: date.ch_lpos_certi
    },
    rates_t0: { wx: date.wx_t0, ali: date.ali_t0 },
    rates_t1: { wx: date.wx_t1, ali: date.ali_t1 },
    pos_rates: {
      debit: {
        d1: {
          rate: date.debit_d1,
          ceiling: date.debit_money
        },
        d0: {
          rate: date.debit_d0
        }
      },
      credit: {
        d1: {
          rate: date.credit_d1
        },
        d0: {
          rate: date.credit_d0
        }
      },
      ovsea: {
        d1: {
          rate: date.ovsea_d1
        },
        d0: {
          rate: date.ovsea_d0
        }
      }
    }
  }
  return request({
    url: '/merchant/channel/lepos/apply',
    method: 'POST',
    data
  })
}

/**
 * 新大陆经营类别
 */
export function merchanenlChannelMainlandCategory() {
  return request({
    url: '/merchant/channel/starpos/category',
    method: 'GET'
  })
}

/**
 * 新大陆通道获取
 */
export function merchantChannelMainlanQuery(merchant_num) {
  return request({
    url: '/merchant/channel/starpos/query',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 * 新大陆D0开通
 */
export function merchantChannelD0Open(merchant_num) {
  return request({
    url: '/merchant/channel/starpos/apply_d0',
    method: 'POST',
    data: { merchant_num }
  })
}

/**
 * 新大陆通道更新提交
 * @param {Number} merchant_num 商户编号
 * @param {Object} date 提交参数
 */
export function merchantChannelMainlanUpdate(merchant_num, date) {
  const data = {
    merchant_num,
    industry: date.industry,
    area: date.area,
    address: date.address,
    balance_type: date.balance_type,
    d0_cash: date.d0_cash,
    photo: {
      channel_starpos_mch_info: date.channel_starpos_mch_info,
      channel_starpos_stofc_payee: date.channel_starpos_stofc_payee,
      channel_starpos_agreement: date.channel_starpos_agreement,
      ch_spos_certi: date.ch_spos_certi,
      ch_spos_certi_inhand: date.ch_spos_certi_inhand
    },
    tran_types: date.tran_types,
    trm_num: date.trm_num,
    scan: date.scan,
    unionpay_dis: date.unionpay_sta,
    unionpay_sta: date.unionpay_dis,
    support_currency: date.supt_card,
    is_supt_dbfree_flg: date.is_supt_dbfree_flg,
    pos_debit_max: date.pos_debit_max,
    credit: date.debit,
    card_type: date.card_type,
    debit: date.credit
  }
  return request({
    url: '/merchant/channel/starpos/apply',
    method: 'POST',
    data
  })
}

/**
 * 网商经营类别获取
 */
export function merchanenlChannelWsCategory() {
  return request({
    url: '/merchant/channel/wangshang/ws_category',
    method: 'GET'
  })
}

/**
 * 网商短信验证码
 */
export function merchanenlChannelWsMsg(merchant_num) {
  return request({
    url: '/merchant/channel/wangshang/send_ms_code',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 * 网商手机号码
 */
export function merchanenlChannelWsPhone(merchant_num) {
  return request({
    url: 'merchant/channel/wangshang/get_mobile',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 * 网商普通通道提交
 */
export function merchanenlChannelWsUpdate(merchant_num, date) {
  return request({
    url: '/merchant/channel/wangshang/apply',
    method: 'POST',
    data: { merchant_num, verify_msg: date.msgCode, address: date.address, area: date.area, industry: date.industry, wx: date.wx_rate, ali: date.ali_rate, balance_type: date.balance_type }
  })
}

/**
 * 网商活动通道提交
 */
export function merchanenlChannelWsActiUpdate(merchant_num, date) {
  return request({
    url: '/merchant/channel/wangshang/create_special_channel',
    method: 'POST',
    data: { merchant_num, verify_msg: date.msgCode, address: date.address, is_blue: date.is_blue, area: date.area, industry: date.industry, wx: date.wx_rate, ali: date.ali_rate, balance_type: date.balance_type }
  })
}

/**
 * 网商普通通道查看
 */
export function merchanenlChannelWsQuery(merchant_num) {
  return request({
    url: '/merchant/channel/wangshang/get_apply_info',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 * 网商活动通道查看
 */
export function merchanenlChannelWsActiviQuery(merchant_num) {
  return request({
    url: '/merchant/channel/wangshang/get_special_apply_info',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 *网商活动审核查看
 *
 * @export Function
 * @param {Number} merchant_num 商户号
 * @returns JSON
 */
export function merchantChannelWsActivityAudit(merchant_num) {
  return request({
    url: '/merchant/get_special_wangshang_apply_info',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 * 网商通道普通审核查看
 */
export function verfiryChannelWsQuery(merchant_num) {
  return request({
    url: '/merchant/get_wangshang_apply_info',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 * 富民通道审核查看
 * @param {Number} merchant_num 商户编号
 */
export function verfiryChannelFuQuery(merchant_num) {
  return request({
    url: '/merchant/get_fumin_channel_verify',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 * 乐刷通道审核查看
 * @param {Number} merchant_num 商户编号
 */
export function verfiryChannelLeQuery(merchant_num) {
  return request({
    url: '/merchant/channel/lepos/query',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 * 新大陆通道审核查看
 * @param {Number} merchant_num 商户编号
 */
export function verfiryChannelMainlandQuery(merchant_num) {
  return request({
    url: '/merchant/channel/starpos/query',
    method: 'GET',
    params: { merchant_num }
  })
}

/**
 * 微信通道普通审核提交
 * @param {Number} merchant_num 商户编号
 * @param {Number} status 状态码
 * @param {String} error_info 拒绝原因
 */
export function verfiryChannelWxValid(merchant_num, status, error_info) {
  return request({
    url: '/merchant/channel/wx/update_wx_check_hannel',
    method: 'GET',
    params: { merchant_num, status, error_info }
  })
}

/**
 * 支付宝通道普通审核提交
 * @param {Number} merchant_num 商户编号
 * @param {Number} status 状态码
 * @param {String} error_info 拒绝原因
 */
export function verfiryChannelAliValid(merchant_num, status, error_info) {
  return request({
    url: '/merchant/channel/ali/update_ali_check_channel',
    method: 'GET',
    params: { merchant_num, status, error_info }
  })
}

/**
 * 网商通道审核提交
 * @param {Number} merchant_num 商户编号
 * @param {Number} status 状态码
 * @param {String} error_info 拒绝原因
 * @param {Boolean} is_blue 蓝海行动
 */
export function verfiryChannelWsValid(merchant_num, status, is_blue, error_info) {
  return request({
    url: '/merchant/channel/wangshang/check_apply',
    method: 'GET',
    params: { merchant_num, status, is_blue, error_info }
  })
}

/**
 * 富民通道普通审核提交
 * @param {Number} merchant_num 商户编号
 * @param {Number} status 状态码
 * @param {String} error_info 拒绝原因
 */
export function verfiryChannelFuValid(merchant_num, status, error_info) {
  return request({
    url: '/merchant/channel/fuming/check',
    method: 'GET',
    params: { merchant_num, status, error_info }
  })
}

/**
 * 富民通道普通审核提交
 * @param {Number} merchant_num 商户编号
 * @param {Number} status 状态码
 * @param {String} error_info 拒绝原因
 */
export function verfiryChannelFuActiviValid(merchant_num, status, error_info) {
  return request({
    url: '/merchant/channel/fuming/set_special_merchant_check_channel',
    method: 'GET',
    params: { merchant_num, status, error_info }
  })
}

/**
 * 乐刷通道审核提交
 * @param {Number} merchant_num 商户编号
 * @param {Number} status 状态码
 * @param {String} error_info 拒绝原因
 */
export function verfiryChannelLeValid(merchant_num, status, error_info) {
  return request({
    url: '/merchant/channel/lepos/check',
    method: 'GET',
    params: { merchant_num, status, error_info }
  })
}

/**
 * 新大陆通道审核提交
 * @param {Number} merchant_num 商户编号
 * @param {Number} status 状态码
 * @param {String} error_info 拒绝原因
 */
export function verfiryChannelMainlandValid(merchant_num, status, error_info) {
  return request({
    url: '/merchant/channel/starpos/check',
    method: 'GET',
    params: { merchant_num, status, error_info }
  })
}

/**
 * 查看门店
 * @param {Number} merchant_num 商户id
 */
export function querystoreInit(merchant_id) {
  return request({
    url: '/merchant/store/list',
    method: 'GET',
    params: { merchant_id }
  })
}

/**
 * 查看门店分页
 * @param {Number} merchant_num 商户id
 * @param {Number} page 商户id
 */
export function querystorePage(merchant_id, page) {
  return request({
    url: '/merchant/store/list',
    method: 'GET',
    params: { merchant_id, page }
  })
}

/**
 * 修改门店初始化
 * @param {Number} id 门店id
 */
export function editStoreInit(store_id) {
  return request({
    url: '/merchant/store/edit',
    method: 'GET',
    params: { store_id }
  })
}

/**
 * 修改门店初始化所属门店
 * @param {Number} id 门店id
 */
export function editStoreIdInit(store_id) {
  return request({
    url: '/merchant/store/Ed_staff',
    method: 'GET',
    params: { store_id }
  })
}

/**
 * 修改门店提交
 * @param {Number} id 门店id
 */
export function editStoreSubmit(id, date) {
  const data = {
    id,
    staff_id: date.staff_id,
    store_name: date.store_name,
    store_number: date.store_number,
    store_area: date.store_area,
    store_address: date.store_address,
    store_status: date.store_status
  }
  return request({
    url: '/merchant/store/edit',
    method: 'POST',
    data
  })
}
/**
 * 删除门店
 * @param {Number} id 门店id
 */
export function querystoreDel(store_id) {
  return request({
    url: '/merchant/store/del',
    method: 'GET',
    params: { store_id }
  })
}

/**
 * 添加门店提交
 * @param {Number} id 商户id
 * @param {Object} date 提交参数
 */
export function addStoreSubmit(merchant_id, date) {
  const data = {
    merchant_id,
    store_name: date.store_name,
    store_number: date.store_number,
    store_area: date.store_area,
    store_address: date.store_address,
    store_status: date.store_status
  }
  return request({
    url: '/merchant/store/add',
    method: 'POST',
    data
  })
}

/**
 * 查看店员初始化
 * @param {Number} store_id 门店id
 */
export function chekcUserInit(store_id) {
  return request({
    url: '/merchant/staff/info',
    method: 'GET',
    params: { store_id }
  })
}

/**
 * 查看店员分页
 * @param {Number} store_id 门店 id
 * @param {Number} page 页码
 */
export function checkUserPage(store_id, page) {
  return request({
    url: '/merchant/staff/info',
    method: 'GET',
    params: { store_id, page }
  })
}

/**
 * 查看店员删除
 * @param {Number} store_id 店员id
 */
export function checkUserDel(staff_id) {
  return request({
    url: '/merchant/staff/del',
    method: 'GET',
    params: { staff_id }
  })
}

/**
 * 查看店员修改初始化
 * @param {Number} staff_id 店员id
 */
export function editUserInit(staff_id) {
  return request({
    url: '/merchant/staff/edit',
    method: 'GET',
    params: { staff_id }
  })
}

/**
 * 查看店员所属门店获取
 * @param {Number} store_id 门店id
 */
export function editUserStoreInit(store_id) {
  return request({
    url: '/merchant/staff/ownStaff',
    method: 'GET',
    params: { store_id }
  })
}

/**
 * 查看店员修改提交
 * @param {Object} date 修改店员参数
 */
export function editUserSubmit(staff_id, date) {
  const data = {
    staff_id,
    store_id: date.id,
    username: date.username,
    passwd: date.passwd,
    staff_name: date.staff_name,
    position: date.position,
    status: date.radio
  }
  return request({
    url: '/merchant/staff/edit',
    method: 'POST',
    data
  })
}

/**
 * 添加员工初始化
 * @param {Number} store_id 门店id
 */
export function addUserInit(store_id) {
  return request({
    url: '/merchant/staff/staff_list',
    method: 'GET',
    params: { store_id }
  })
}

/**
 * 添加员工提交
 * @param {Object} date 添加员工参数
 */
export function addUserSubmit(date) {
  const data = {
    store_id: date.id,
    username: date.username,
    passwd: date.passwd,
    staff_name: date.staff_name,
    position: date.position,
    status: date.radio,
    store_name: date.store_name
  }
  return request({
    url: '/merchant/staff/add',
    method: 'POST',
    data
  })
}

/**
 * 新增通道初始化
 * @param {Number} id 商户id
 */
export function addAisleInit(id) {
  return request({
    url: '/addChannel',
    method: 'GET',
    params: { merchant_id: id }
  })
}

/**
 * 新增通道网商银行地址初始化 省份
 */
export function handleItemInit() {
  return request({
    url: '/wsProvince',
    method: 'GET'
  })
}

/**
 * 新增通道网商银行经营行业初始化
 */
export function handleWsItemInit() {
  return request({
    url: '/wsCategory',
    method: 'GET'
  })
}

/**
 * 新增通道平安银行经营行业初始化 省份
 */
export function pnMccInit() {
  return request({
    url: '/pnMcc',
    method: 'GET'
  })
}

/**
 * 新增通道平安银行他行初始化 省份
 */
export function banknameInit() {
  return request({
    url: '/bankname',
    method: 'GET'
  })
}

/**
 * 新增通道平安银行经营地址初始化 省份
 */
export function pnProvinceInit() {
  return request({
    url: '/pnProvince',
    method: 'GET'
  })
}

/**
 * 新增通道平安银行门店分类初始化
 */
export function pnCategoryInit() {
  return request({
    url: '/pnCategory',
    method: 'GET'
  })
}

/**
 * 审核通道平安绑卡
 * @param {Number} id 商户id
 */
export function pnValidBindBank(id) {
  return request({
    url: '/witnessBindBank',
    method: 'GET',
    params: { id }
  })
}

/**
 * 平安短信鉴权
 * @param {Number} id 商户id
 * @param {Number} message_code 验证码
 */
export function pnValidCode(id, message_code) {
  const data = {
    id,
    message_code
  }
  return request({
    url: '/witnessBindVerifyMessage',
    method: 'POST',
    data
  })
}

/**
 * 平安小额打款鉴权
 * @param {Number} id 商户id
 * @param {Number} money 验证码
 */
export function pnValidMoney(id, money) {
  const data = {
    id,
    money
  }
  return request({
    url: '/witnessBindVerifyMoney',
    method: 'POST',
    data
  })
}

/**
 * 查看通道初始化查看通道初始化
 * @param {Number} id 商户id
 */
export function affiliatedBusinessesListInit(id) {
  return request({
    url: '/subQuery',
    method: 'GET',
    params: { merchant_id: id }
  })
}

/**
 * 下属商户查看通道基础资料初始化
 * @param {Number} id 商户id
 */
export function affiliatedBusinessesBaseInfo(id) {
  return request({
    url: '/baseInfo',
    method: 'GET',
    params: { merchant_id: id }
  })
}

/**
 * 下属商户查看微信通道资料初始化
 * @param {Number} id 商户id
 */
export function affiliatedBusinessesWxChannelInit(id) {
  return request({
    url: '/wxChannel',
    method: 'GET',
    params: { merchant_id: id }
  })
}

/**
 * 下属商户查看支付宝通道资料初始化
 * @param {Number} id 商户id
 */
export function affiliatedBusinessesAliChannelInit(id) {
  return request({
    url: '/aliChannel',
    method: 'GET',
    params: { merchant_id: id }
  })
}

/**
 * 下属商户查看网商银行通道资料初始化
 * @param {Number} id 商户id
 */
export function affiliatedBusinessesWsChannelInit(id) {
  return request({
    url: '/wsChannel',
    method: 'GET',
    params: { merchant_id: id }
  })
}

/**
 * 下属商户查看平安银行通道资料初始化
 * @param {Number} id 商户id
 */
export function affiliatedBusinessesPingChannelInit(id) {
  return request({
    url: '/pingChannel',
    method: 'GET',
    params: { merchant_id: id }
  })
}

/**
 * 基础资料初始化
 * @param {Number} id 商户id
 */
export function baseInfoInit(id) {
  return request({
    url: '/baseInfo',
    method: 'GET',
    params: { merchant_id: id }
  })
}

/**
 * 微信官方初始化
 * @param {Number} id 商户id
 */
export function wxInfoInit(id) {
  return request({
    url: '/wxEdit',
    method: 'GET',
    params: { merchant_id: id }
  })
}

/**
 * 微信通道修改提交
 * @param {Number} wx_commerID 商户号
 * @param {String} Appid 微信appid
 * @param {Number} rate 微信官方费率
 */
export function wxAisleEditSub(merchant_id, wx_commerID, Appid, rate) {
  const data = {
    wx_commerID,
    Appid,
    rate,
    merchant_id,
    channel_status: 3
  }
  return request({
    url: '/wxEdit',
    method: 'POST',
    data
  })
}

/**
 * 微信通道提交
 * @param {Number} wx_commerID 商户号
 * @param {String} Appid 微信appid
 * @param {Number} rate 微信官方费率
 */
export function wxAisleSub(merchant_id, wx_commerID, Appid, rate) {
  const data = {
    wx_commerID,
    Appid,
    rate,
    merchant_id,
    channel_status: 3
  }
  return request({
    url: '/wxSubmit',
    method: 'POST',
    data
  })
}
/**
 * 支付宝官方通道初始化获取授权PID
 * @param {Number} merchant_id 商户id
 */
export function aliInfoInit(merchant_id) {
  return request({
    url: '/authorized',
    method: 'GET',
    params: { merchant_id }
  })
}

/**
 * 微信官方初始化
 * @param {Number} id 商户id
 */
export function aliEditInfoInit(id) {
  return request({
    url: '/aliEdit',
    method: 'GET',
    params: { merchant_id: id }
  })
}

/**
 * 支付宝修改提交
 * @param {Number} ali_account 账号
 * @param {String} ali_PID 支付宝appid
 * @param {Number} ali_rate 支付宝官方费率
 */
export function aliAisleEditSub(merchant_id, date) {
  const data = {
    merchant_id,
    ali_account: date.appid,
    ali_pid: date.shop_id,
    ali_rate: date.rate,
    channel_status: 3
  }
  return request({
    url: '/aliEdit',
    method: 'POST',
    data
  })
}

/**
 * 支付宝通道提交
 * @param {Number} ali_account 账号
 * @param {String} ali_PID 支付宝appid
 * @param {Number} ali_rate 支付宝官方费率
 */
export function aliAisleSub(merchant_id, date) {
  const data = {
    merchant_id,
    ali_account: date.appid,
    ali_pid: date.shop_id,
    ali_rate: date.rate,
    channel_status: 3
  }
  return request({
    url: '/aliSubmit',
    method: 'POST',
    data
  })
}

/**
 * 网商支付通道提交
 * @param {Object} date 网商通道参数
 */
export function wsAisleSub(merchant_id, date) {
  const data = {
    merchant_id,
    is_blue: date.lh,
    commer_type: date.commer_type,
    alias: date.alias,
    commer_name: date.commer_name,
    commer_address: date.commer_address,
    real_address: date.real_address,
    contact_name: date.contact_name,
    contact_tel: date.contact_tel,
    serverPhone: date.serverPhone,
    email: date.email,
    lead_name: date.lead_name,
    lead_identity_card: date.lead_identity_card,
    lead_phone: date.lead_phone,
    business_license: date.business_license,
    ali_nickname: date.ali_nickname,
    ali_account: date.ali_account,
    credit: date.credit,
    ws_bank_config: date.ws_bank_config,
    pay_config_rate: {
      ws_wx_rate: date.ws_wx_rate,
      ws_ali_rate: date.ws_ali_rate
    },
    wxchat_config: {
      pay_id: date.pay_id,
      recommend: date.recommend,
      app_secret: date.secret
    },
    account_type: date.account_type,
    bank_num: date.bank_num,
    commer_mcc: date.commer_mcc,
    card_name: date.card_name,
    bank_type: date.bank_type,
    bank_area: date.bank_area,
    bank_branch_name: date.bank_branch_name,
    identify_card: date.identify_card,
    identify_area: date.identify_area,
    phone: date.phone,
    verify_code: date.verify_code,
    bankno: date.bankno,
    person_photo: { positive: date.positive, opposite: date.opposite, handtive: date.handtive, banktive: date.banktive },
    store_photo: { shop: date.shop, certificate: date.certificate, permit: date.permit, license: date.license, checkstand_pic: date.counter, indoor_pic: date.store, settled_pic: date.platform },
    channel_status: 1
  }
  return request({
    url: '/wsSubmit',
    method: 'POST',
    data
  })
}

/**
 * 网商支付通道修改提交
 * @param {Object} date 网商通道参数
 */
export function wsAisleEditSub(merchant_id, date) {
  const data = {
    merchant_id,
    commer_type: date.commer_type,
    alias: date.alias,
    is_blue: date.lh,
    commer_name: date.commer_name,
    commer_address: date.commer_address,
    contact_name: date.contact_name,
    contact_tel: date.contact_tel,
    real_address: date.real_address,
    serverPhone: date.serverPhone,
    email: date.email,
    lead_name: date.lead_name,
    lead_identity_card: date.lead_identity_card,
    lead_phone: date.lead_phone,
    business_license: date.business_license,
    ali_nickname: date.ali_nickname,
    ali_account: date.ali_account,
    credit: date.credit,
    ws_bank_config: date.ws_bank_config,
    pay_config_rate: {
      ws_wx_rate: date.ws_wx_rate,
      ws_ali_rate: date.ws_ali_rate
    },
    wxchat_config: {
      pay_id: date.pay_id,
      recommend: date.recommend,
      app_secret: date.secret
    },
    account_type: date.account_type,
    bank_num: date.bank_num,
    commer_mcc: date.commer_mcc,
    card_name: date.card_name,
    bank_type: date.bank_type,
    bank_area: date.bank_area,
    bank_branch_name: date.bank_branch_name,
    identify_card: date.identify_card,
    identify_area: date.identify_area,
    phone: date.phone,
    verify_code: date.verify_code,
    bankno: date.bankno,
    person_photo: { positive: date.positive, opposite: date.opposite, handtive: date.handtive, banktive: date.banktive },
    store_photo: { shop: date.shop, certificate: date.certificate, permit: date.permit, license: date.license, checkstand_pic: date.counter, indoor_pic: date.store, settled_pic: date.platform },
    channel_status: 1
  }
  return request({
    url: '/wsEdit',
    method: 'POST',
    data
  })
}

/**
 * 修改网商支付通道资料-获取
 * @param {Number} merchant_id 商户id
 */
export function handleWsEditItem(merchant_id) {
  return request({
    url: '/wsEdit',
    method: 'GET',
    params: { merchant_id }
  })
}

/**
 * 蓝海行动查询
 * @param {Number} merchant_id 商户id
 */
export function handleWsBlueValid(merchant_id) {
  return request({
    url: '/isBlue',
    method: 'GET',
    params: { merchant_id }
  })
}

/**
 * 老商户参加蓝海
 * @param {Object} date 传递参数
 */
export function handleWsBlueOldAdd(merchant_id, date) {
  const data = {
    merchant_id, checkstand_pic: date.counter, indoor_pic: date.store, settled_pic: date.platform
  }
  return request({
    url: '/blueUpdate',
    method: 'POST',
    data
  })
}

/**
 * 网商银行支行远程搜索
 * @param {String} bankno 查询参数
 */
export function remoteMethodQuery(bankno) {
  return request({
    url: '/merchant/channel/wangshang/bank_no',
    method: 'GET',
    params: { bankno }
  })
}

/**
 * 审核渠道报单 查询按钮
 * @param {Number} merchant_id 商户id
 */
export function settleSearchInit(merchant_id) {
  return request({
    url: '/wsInfoQuery',
    method: 'GET',
    params: { merchant_id }
  })
}

/**
 * 审核商户详情修改提交
 * @param {Number} merchant_id 商户id
 * @param {Object} date 修改参数
 * @param {Object} obj 反值参数
 */
export function wsInfoSubmit(merchant_id, date, obj) {
  const data = {
    merchant_id,
    AlipayOnlineSource: obj.AlipayOnlineSource,
    AlipaySource: obj.AlipaySource,
    BankCardParam: {
      AccountType: date.account_type,
      BankCardNo: date.bank_num,
      BankCertName: date.card_name,
      BranchName: date.bank_branch_name,
      CardHolderAddress: date.real_address,
      CertNo: date.identify_card,
      CertType: obj.CertType,
      BankCode: date.bank_type,
      bank_area: date.bank_area
    },
    DealType: obj.DealType,
    DeniedPayToolList: obj.DeniedPayToolList,
    FeeParamList: [
      { ChannelType: obj.ChannelType01, FeeType: obj.FeeType01, FeeValue: date.ws_ali_rate },
      { ChannelType: obj.ChannelType02, FeeType: obj.FeeType02, FeeValue: date.ws_wx_rate }
    ],
    Mcc: date.commer_mcc,
    MerchantDetail: {
      Alias: date.alias,
      CertPhotoA: obj.CertPhotoA,
      CertPhotoB: obj.CertPhotoB,
      ContactMobile: date.contact_tel,
      ContactName: date.contact_name,
      LicensePhoto: obj.LicensePhoto,
      OtherPhoto: obj.OtherPhoto,
      PrincipalCertType: obj.PrincipalCertType,
      PrincipalCertNo: date.lead_identity_card,
      // PrincipalMobile: date.lead_phone,
      ServicePhoneNo: date.serverPhone,
      PrincipalPerson: date.lead_name,
      ShopPhoto: obj.ShopPhoto
    },
    MerchantId: obj.MerchantId,
    MerchantName: date.commer_name,
    Merchant_Type: obj.Merchant_Type,
    PayChannelList: obj.PayChannelList,
    SettleMode: obj.SettleMode,
    Smid: obj.Smid,
    SupportPrepayment: obj.SupportPrepayment,
    SupportStage: obj.SupportStage,
    TradeTypeList: obj.TradeTypeList
  }
  return request({
    url: '/wsInfoEdit',
    method: 'POST',
    data
  })
}

/**
 * 审核渠道报单网商通道开启商户
 * @param {Number} merchant_id 商户id'
 */
export function WsOPen(merchant_id) {
  return request({
    url: '/openMerchant',
    method: 'PUT',
    params: { merchant_id, status: 1 }
  })
}

/**
 * 审核渠道报单网商通道关闭商户
 * @param {Number} merchant_id 商户id'
 */
export function WsClose(merchant_id, mes) {
  return request({
    url: '/closeMerchant',
    method: 'PUT',
    params: { merchant_id, status: 0, freeze_reason: mes }
  })
}

/**
 * 平安银行通道提交
 * @param {Number} merchant_id 商户ID
 * @param {Object} date 提交参数
 */
export function pnAisleSub(merchant_id, date) {
  const data = {
    merchant_id,
    store_type: date.store_type,
    commer_name: date.commer_name,
    short_name: date.short_name,
    commer_address: date.commer_address,
    real_address: date.real_address,
    account_name: date.account_name,
    bank_number: date.bank_number,
    bank_account: date.bank_account,
    sub_bank: date.sub_bank,
    identify_name: date.identify_name,
    identify_card: date.identify_card,
    industry_type: date.industry_type,
    pa_wx_rate: date.pa_wx_rate,
    contact_phone: date.contact_phone,
    pa_ali_rate: date.pa_ali_rate,
    wxchat_config: date.wxchat_config,
    pay_config_rate: date.pay_config_rate,
    person_photo: { handtive: date.handtive, positive: date.positive, opposite: date.opposite },
    store_photo: { shop: date.shop, license: date.license },
    channel_status: 1,
    bank_category: date.bank,
    key: date.key,
    business_license_type: date.business_license_type,
    contact_type: date.contact_type,
    business_license: date.business_license,
    service_phone: date.service_phone,
    con_phone: date.con_phone,
    contact_email: date.contact_email,
    memo: date.memo,
    id_type: date.id_type,
    public_private: date.account_type,
    contact_name: date.contact_name,
    number: date.idtynum
  }
  return request({
    url: '/pnSubmit',
    method: 'POST',
    data
  })
}

/**
 * 平安银行通道修改提交 - 修改
 * @param {Number} merchant_id 商户ID
 * @param {Object} date 提交参数
 */
export function pnAisleEditSub(merchant_id, date) {
  const data = {
    merchant_id,
    store_type: date.store_type,
    commer_name: date.commer_name,
    short_name: date.short_name,
    commer_address: date.commer_address,
    real_address: date.real_address,
    account_name: date.account_name,
    bank_number: date.bank_number,
    bank_account: date.bank_account,
    sub_bank: date.sub_bank,
    identify_name: date.identify_name,
    identify_card: date.identify_card,
    industry_type: date.industry_type,
    pa_wx_rate: date.pa_wx_rate,
    contact_phone: date.contact_phone,
    pa_ali_rate: date.pa_ali_rate,
    wxchat_config: date.wxchat_config,
    pay_config_rate: date.pay_config_rate,
    person_photo: { handtive: date.handtive, positive: date.positive, opposite: date.opposite },
    store_photo: { shop: date.shop, license: date.license },
    channel_status: 1,
    bank_category: date.bank,
    key: date.key,
    business_license_type: date.business_license_type,
    contact_type: date.contact_type,
    business_license: date.business_license,
    service_phone: date.service_phone,
    con_phone: date.con_phone,
    contact_email: date.contact_email,
    memo: date.memo,
    id_type: date.id_type,
    public_private: date.account_type,
    contact_name: date.contact_name,
    number: date.idtynum
  }
  return request({
    url: '/pnEdit',
    method: 'POST',
    data
  })
}

/**
 * 平安获取证件类型
 * @param {Number} type 1对私 2对公
 */
export function pnAisleType(type) {
  return request({
    url: '/type',
    method: 'GET',
    params: { id_type: type }
  })
}

/**
 * 联行号远程搜索
 * @param {String} date 查询参数
 */
export function pnGetLinkBank(date) {
  return request({
    url: '/bank',
    method: 'GET',
    params: { bankname: date }
  })
}

/**
 * 平安银行通道资料修改-获取
 * @param {Number} merchant_id 商户id
 */
export function pnAilsleEdit(merchant_id) {
  return request({
    url: '/pnEdit',
    method: 'GET',
    params: { merchant_id }
  })
}

/**
 * 商户报单初始化
 * @param {Number} id 代理商id
 */
export function commerForm(id) {
  return request({
    url: '/commerForm',
    method: 'GET',
    params: { id }
  })
}

/**
 * 商户报单查询
 * @param {Number} id 代理商id
 * @param {Object} date 查询参数
 */
export function commerFormSearch(id, date) {
  return request({
    url: '/commerForm',
    method: 'GET',
    params: { id, serial_num: date.serial_num, store: date.store, print_name: date.name, start: date.startTime, end: date.endTime }
  })
}

/**
 * 商户报单分页
 * @param {Number} id 代理商id
 * @param {Object} date 查询参数
 * @param {Number} page 页码
 */
export function commerFormPage(id, page, date) {
  return request({
    url: '/commerForm',
    method: 'GET',
    params: { id, page, serial_num: date.serial_num, store: date.store, print_name: date.name, start: date.startTime, end: date.endTime }
  })
}

/**
 * 审核报单初始化
 * @param {Number} id 代理商id
 */
export function verifychannelformInit(id) {
  return request({
    url: '/verifychannelform',
    method: 'GET',
    params: { id }
  })
}

/**
 * 审核报单查询
 * @param {Number} id 代理商id
 * @param {Object} date 查询参数
 */
export function verifychannelformSearch(id, date) {
  return request({
    url: '/verifychannelform',
    method: 'GET',
    params: { id, agent_name: date.agent_name, store: date.store, serial_num: date.serial_num, base_info_status: date.base_info_status }
  })
}

/**
 * 审核报单页码
 * @param {Number} id 代理商id
 * @param {Object} date 查询参数
 * @param {Number} page 页码
 */
export function verifychannelformPage(id, page, date) {
  return request({
    url: '/verifychannelform',
    method: 'GET',
    params: { id, page, agent_name: date.agent_name, store: date.store, serial_num: date.serial_num, base_info_status: date.base_info_status }
  })
}

/**
 * 审核报单查看初始化
 * @param {Number} merchant_id 商户id
 */
export function verifyChannelQueryInit(merchant_id) {
  return request({
    url: '/verifyChannelQuery',
    method: 'GET',
    params: { merchant_id }
  })
}

/**
 * 审核报单基础资料查看初始化
 * @param {Number} merchant_id 商户id
 */
export function verifyBaseInfoInit(merchant_id) {
  return request({
    url: '/verifyBaseInfo',
    method: 'GET',
    params: { merchant_id }
  })
}

/**
 * 审核报单基础资料审核状态更新
 * @param {Number} merchant_id 商户id
 * @param {Number} verifyResult 0 拒绝 1通过
 */
export function verifyBaseInfoUpdate(merchant_id, baseinfo_verify_status) {
  const data = {
    merchant_id,
    baseinfo_verify_status
  }
  return request({
    url: '/verifyBaseInfo',
    method: 'POST',
    data
  })
}

/**
 * 审核报单微信官方通道资料查看初始化
 * @param {Number} merchant_id 商户id
 */
export function verifyWxInit(merchant_id) {
  return request({
    url: '/verifyWx',
    method: 'GET',
    params: { merchant_id }
  })
}

/**
 * 审核报单微信官方通道资料状态更新
 * @param {Number} merchant_id 商户id
 * @param {Number} channel_status -1 拒绝 4通过
 */
export function verifyWxUpdate(merchant_id, channel_status) {
  const data = { merchant_id, channel_status }
  return request({
    url: '/verifyWx',
    method: 'POST',
    data
  })
}

/**
 * 审核报单支付宝官方通道资料查看初始化
 * @param {Number} merchant_id 商户id
 */
export function verifyAliInit(merchant_id) {
  return request({
    url: '/verifyAli',
    method: 'GET',
    params: { merchant_id }
  })
}

/**
 * 审核报单支付宝官方通道资料状态更新
 * @param {Number} merchant_id 商户id
 * @param {Number} channel_status -1 拒绝 4通过
 */
export function verifyAliUpdate(merchant_id, channel_status) {
  const data = { merchant_id, channel_status }
  return request({
    url: '/verifyAli',
    method: 'POST',
    data
  })
}

/**
 * 审核报单网商通道资料查看初始化
 * @param {Number} merchant_id 商户id
 */
export function verifyWsInit(merchant_id) {
  return request({
    url: '/verifyWs',
    method: 'GET',
    params: { merchant_id }
  })
}

/**
 * 审核报单网商通道图片回传
 */
export function validateWsImgUpload(url, type) {
  const data = {
    type,
    wsBankUploadPhoto: url
  }
  return request({
    url: '/wsBankUploadPhoto',
    method: 'POST',
    data
  })
}

/**
 * 审核报单网商通道资料状态更新
 * @param {Number} merchant_id 商户id
 * @param {Number} channel_status -1拒绝 3通过
 */
export function verifyWsUpdate(merchant_id, channel_status) {
  const data = { merchant_id, channel_status }
  return request({
    url: '/verifyWs',
    method: 'POST',
    data
  })
}

/**
 * 审核报单平安通道资料查看初始化
 * @param {Number} merchant_id 商户id
 */
export function verifyPAInit(merchant_id) {
  return request({
    url: '/verifyPA',
    method: 'GET',
    params: { merchant_id }
  })
}

/**
 * 审核报单平安通道资料状态更新
 * @param {Number} merchant_id 商户id
 * @param {Number} channel_status -1拒绝 3通过
 */
export function verifyPAUpdate(merchant_id, channel_status) {
  const data = { merchant_id, channel_status }
  return request({
    url: '/verifyPA',
    method: 'POST',
    data
  })
}

/**
 * 商户二维码初始化
 * @param {Number} id 代理商id
 */
export function qrListInit(agent_num) {
  return request({
    url: '/merchant/qr/qr_list',
    params: { agent_num }
  })
}

/**
 * 商户二维码查询
 * @param {Object} date 查询参数
 */
export function handleQrListSearch(agent_num, date) {
  const data = {
    agent_num,
    merchant_num: date.merchant_num,
    store_id: date.store_id,
    qr_status: date.qr_status,
    start: date.time[0],
    end: date.time[1]
  }
  return request({
    url: '/merchant/qr/qr_list',
    method: 'POST',
    data
  })
}

/**
 * 商户二维码分页
 * @param {Object} date 查询参数
 * @param {Numger} page 页码
 */
export function handleQrListPage(agent_num, page, date) {
  const data = {
    page,
    agent_num,
    merchant_num: date.merchant_num,
    store_id: date.store_id,
    qr_status: date.qr_status,
    start: date.time[0],
    end: date.time[1]
  }
  return request({
    url: '/merchant/qr/qr_list',
    method: 'POST',
    data
  })
}

/**
 * 商户二维码收款初始化
 * @param {Number} id 代理商id
 */
export function receListInit(id) {
  return request({
    url: '/merchant/qr/rece_list',
    method: 'GET',
    params: { id }
  })
}

/**
 * 商户二维码收款情况 订单状态获取
 */
export function handleGetOrderInti() {
  return request({
    url: '/merchant/qr/order_status',
    method: 'GET'
  })
}

/**
 * 商户二维码收款情况分页
 * @param {Object} date 查询参数
 */
export function handleOrderPage(page, date) {
  const data = {
    page,
    id: date.id,
    store: date.store,
    agent_name: date.agent_name,
    receive_account: date.receive_account,
    status: date.status,
    start: date.start,
    end: date.end
  }
  return request({
    url: '/merchant/qr/rece_list',
    method: 'POST',
    data
  })
}

/**
 * 商户二维码收款情况查询
 * @param {Object} date 查询参数
 */
export function handleOrderSearch(date) {
  const data = {
    id: date.id,
    store: date.store,
    agent_name: date.agent_name,
    receive_account: date.receive_account,
    status: date.status,
    start: date.start,
    end: date.end
  }
  return request({
    url: '/merchant/qr/rece_list',
    method: 'POST',
    data
  })
}

/**
 * 二维码导出
 * @param { Object } date 导出参数
 * @param { Number } store_id 商户id
 */
export function handleCodeDown(store_id, date) {
  const data = { store_id, softwares: date.style, style: date.softwares }
  return request({
    url: '/merchant/qr/export',
    method: 'POST',
    data
  })
}

/**
 * 商户支付通道配置
 * @param {Number} merchant_id 商户id
 */
export function handlePayChannelInit(merchant_id) {
  return request({
    url: '/channelConfig',
    method: 'GET',
    params: { merchant_id }
  })
}

/**
 * 下属商户支付通道配置
 * @param {Number} merchant_id 商户id
 */
export function handleSubPayChannelInit(merchant_id) {
  return request({
    url: '/subChannelConfig',
    method: 'GET',
    params: { merchant_id }
  })
}

/**
 * 商户支付通道配置提交
 * @param {Object} date 配置参数提交
 */
export function handlePayChannelSubmit(date, channel) {
  return request({
    url: '/channelConfig',
    method: 'POST',
    params: { merchant_id: date.id, open_status: { wx_open_status: date.wx_open_status, ali_open_status: date.ali_open_status }, channel }
  })
}

/**
 * 下属商户支付通道配置提交
 * @param {Object} date 配置参数提交
 */
export function handleSubPayChannelSubmit(date, channel) {
  return request({
    url: '/subChannelConfig',
    method: 'POST',
    params: { merchant_id: date.id, open_status: { wx_open_status: date.wx_open_status, ali_open_status: date.ali_open_status }, channel }
  })
}

/**
 * 获取商户门店列表
 */
export function handleStoreList() {
  return request({
    url: '/merchant/qr/store_list',
    method: 'GET'
  })
}

/**
 * 网商银行商户入驻
 * @param {Number} merchant_id 商户id
 */
export function handleWsSettle(merchant_id, date, verify_code) {
  const data = {
    merchant_id,
    date,
    verify_code
  }
  return request({
    url: '/wsEnterNo',
    method: 'POST',
    data
  })
}

/**
 * 网商银行商户入驻结果查询
 * @param {Number} merchant_id 商户id
 */
export function handleWsSettleSearch(merchant_id) {
  const data = {
    merchant_id
  }
  return request({
    url: '/registerQuery',
    method: 'POST',
    data
  })
}

/**
 * 发送短信验证
 * @param {Number} mobile 手机号码
 */
export function smsCodeValidate(mobile) {
  const data = {
    mobile
  }
  return request({
    url: '/sendMsCode',
    method: 'POST',
    data
  })
}

/**
 * 协议查看获取
 * @param {Number} merchant_id 商户id
 * @param {Number} code 协议代号
 */
export function GetPactInfo(merchant_id, code) {
  return request({
    url: '/queryAvg',
    method: 'GET',
    params: { merchant_id, code }
  })
}

/**
 * 门店查看终端初始化
 * @param {Number} store_id 门店id
 */
export function TerminalInit(store_id) {
  return request({
    url: '/merchant/terminal/display',
    method: 'GET',
    params: { store_id }
  })
}

/**
 * 门店查看终端分页
 * @param {Number} store_id 门店id
 * @param {Number} page  页码
 */
export function TerminalTablePage(store_id, page) {
  return request({
    url: '/merchant/terminal/display',
    method: 'GET',
    params: { store_id, page }
  })
}

/**
 * 门店查看终端查看详情
 * @param {Number} bind_id 终端id
 */
export function TerminalCheck(bind_id) {
  return request({
    url: '/merchant/terminal/merchant_detail',
    method: 'GET',
    params: { bind_id }
  })
}

/**
 * 门店查看终端解除绑定
 * @param {Number} bind_id 终端id
 */
export function TerminalRemoveBind(bind_id) {
  return request({
    url: '/merchant/terminal/merchant_relieve',
    method: 'GET',
    params: { bind_id }
  })
}

/**
 * 绑定终端初始化
 * @param {Number} store_id 门店id
 */
export function TerminalBindInit(store_id) {
  return request({
    url: '/terminal/terminal/category',
    method: 'GET',
    params: { store_id }
  })
}

/**
 * 绑定终端名称查询
 * @param {Number} category_id 门店id
 */
export function TerminalBindSearch(category_id) {
  return request({
    url: '/terminal/terminal/dropdown',
    method: 'GET',
    params: { category_id }
  })
}

/**
 * 绑定终端提交
 * @param {Object} date 绑定参数
 * @param {Number} store_id 门店id
 */
export function TerminalBindSubmit(store_id, date) {
  const data = {
    store_id,
    device_category: date.category,
    device_pwd: date.device_pwd,
    device_sn: date.sn,
    device_id: date.name,
    remarks: date.remarks
  }
  return request({
    url: '/merchant/terminal/bind',
    method: 'POST',
    data
  })
}

/**
 * 云喇叭状态消息初始化
 * @param {Number} store_id 门店id
 */
export function CloudSpearkStatusInit(store_id) {
  return request({
    url: '/merchant/terminal/hornlist',
    method: 'GET',
    params: { store_id }
  })
}

/**
 * 云喇叭状态消息查询
 * @param {Number} store_id 门店id
 * @param {Object} date 查询参数
 */
export function CloudSpearkStatusSearch(store_id, date) {
  return request({
    url: '/merchant/terminal/hornlist',
    method: 'GET',
    params: { store_id, sn: date.sn }
  })
}

/**
 * 云喇叭状态消息分页
 * @param {Number} store_id 门店id
 * @param {Object} date 查询参数
 * @param {Number} page 分页页码
 */
export function CloudSpearkStatusPage(store_id, date, page) {
  return request({
    url: '/merchant/terminal/hornlist',
    method: 'GET',
    params: { store_id, sn: date.sn, page }
  })
}

/**
 * 云喇叭状态消息音量设置
 * @param {Number} uid 用户id
 * @param {Number} sn 设备sn
 * @param {Number} vol 音量值
 */
export function CloudSpearkStatusVolume(uid, sn, vol) {
  const data = { uid, sn, vol }
  return request({
    url: '/merchant/terminal/postvol',
    method: 'POST',
    data
  })
}

/**
 * 云喇叭状态消息播报状态获取
 * @param {Number} uid 用户id
 * @param {Number} sn 设备sn
 */
export function CloudSpearkStatusGetvol(uid, sn) {
  return request({
    url: '/merchant/terminal/getvol',
    method: 'GET',
    params: { uid, sn }
  })
}

/**
 * 支付消息历史初始化
 * @param {Number} store_id 门店id
 */
export function CloudSpearkHistoryInit(store_id) {
  return request({
    url: '/merchant/terminal/msglist',
    method: 'GET',
    params: { store_id }
  })
}

/**
 * 支付消息历史查询
 * @param {Number} store_id 门店id
 * @param {Object} date 查询参数
 */
export function CloudSpearkHistorySearch(store_id, date) {
  return request({
    url: '/merchant/terminal/msglist',
    method: 'GET',
    params: { store_id, sn: date.sn }
  })
}

/**
 * 支付消息历史分页
 * @param {Number} store_id 门店id
 * @param {Object} date 查询参数
 * @param {Number} page 页码
 */
export function CloudSpearkHistoryPage(store_id, date, page) {
  return request({
    url: '/merchant/terminal/msglist',
    method: 'GET',
    params: { store_id, sn: date.sn, page }
  })
}
